<?php

// R�cup�re le informations( nom, mdp,...) � partir de l'id de son id


function model_view_playlist($bdd, $playlist) {
    $playlist = $bdd->quote($playlist);

    $results = $bdd->query(
            'SELECT playlists.playlist_name, playlist_sons.son_title
                        FROM playlists
                        INNER JOIN playlist_sons
                        ON playlists.id_playlist = playlist_sons.son_playlist'
    );

    return $results->fetch(PDO::FETCH_ASSOC);
}

function model_create_playlist($bdd, $nom, $autheur, $ambiance, $genre1, $genre2, $genre3, $heure, $soundcloud) {
    $req = $bdd->prepare('INSERT INTO playlists (playlist_name, playlist_author, playlist_ambiance, playlist_genre_1, playlist_genre_2, playlist_genre_3, playlist_date, playlist_adress) VALUES(:nom, :autheur, :ambiance, :genre1, :genre2, :genre3, :heure, :soundcloud)');
    $req->execute(array(
        'nom' => $nom,
        'autheur' => $autheur,
        'ambiance' => $ambiance,
        'genre1' => $genre1,
        'genre2' => $genre2,
        'genre3' => $genre3,
        'heure' => $heure,
        'soundcloud' => $soundcloud
        
    ));
}

?>